<ui:composition template="/WEB-INF/templates/main-template.xhtml"
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">
	<ui:define name="sidebar">
		<ui:include src="/WEB-INF/templates/public-sidebar.xhtml" />
	</ui:define>
	<ui:define name="content">
		<h:form>
			
			<h:panelGrid >
			<h:outputText value="Resources" styleClass="outputTextTitle" />
				<h:panelGrid columns="3">
					<h:outputLabel value="Module " />
					<h:outputLabel value=" : " />
					<p:selectOneMenu value="#{resourcesBean.selectedModuleId}" styleClass="adminSelectOneMenuWidth">
						<f:selectItem itemLabel="Select a module" itemValue=""/>
                    	<f:selectItems value="#{resourcesBean.modulesMap}" />
                    	<p:ajax event="change" listener="#{resourcesBean.moduleChangeListener}" update="@form"/>
                    </p:selectOneMenu>
					<h:outputLabel value="Resource " />
					<h:outputLabel value=" : " />
					<p:selectOneMenu  value="#{resourcesBean.selectedResourceId}" styleClass="adminSelectOneMenuWidth">
					    <f:selectItem itemLabel="Select a resource" itemValue=""/> 
						<f:selectItems value="#{resourcesBean.resourcesMap}" />
						<p:ajax event="change" listener="#{resourcesBean.resourceChangeListener}" update="@form"/>
					</p:selectOneMenu>
				</h:panelGrid>
				
				<h:outputLabel value="Details for " styleClass="outputTextSubTitle"/>
		    
				<h:panelGrid columns="3" style="border: 1px solid #d9d9d9;width:200px;" cellspacing="10">
					<h:outputLabel value="File Name " />
					<h:outputLabel value=" : " />
					<p:inplace>
						<p:inputText value="#{resourcesBean.selectedResource.fileName}" />
					</p:inplace>

					<h:outputLabel value="Display Name " />
					<h:outputLabel value=" : " />
					<p:inplace>
						<p:inputText value="#{resourcesBean.selectedResource.displayName}" />
					</p:inplace>

					<h:outputLabel value="Description " />
					<h:outputLabel value=" : " />
					<p:inplace>
						<p:inputTextarea value="#{resourcesBean.selectedResource.description}" />
					</p:inplace>

					<h:inputHidden />
					<h:inputHidden />
					<p:commandButton value="Save" action="#{resourcesBean.updateResourceAction}" update="@form"/>

				</h:panelGrid>
			</h:panelGrid> 
		</h:form>
	</ui:define>
</ui:composition>

